package util;

public class Position {
	public int x=0;
	public int y=0;
	
	public Position(int x2, int y2) {
		this.x=x2;
		this.y=y2;
	}

	public Position() {}

	public Position move(int dx, int dy) {
		Position res = new Position();
		if (dx!=0)
			res.x = x + dx/Math.abs(dx);
		if (dy!=0)
			res.y = y + dy/Math.abs(dy);
		return res;
	}
	
	public boolean equals(Object obj) {
		if (!(obj instanceof Position))
			return false;
		Position oth = (Position) obj;
		return oth.x==x && oth.y==y;
	}
	
	public String toString() {
		return "("+x+","+y+")";
	}

	public Position copy() {
		return new Position(x,y);
	}
}
